package com.zj.syzs.utils;

import android.os.AsyncTask;

import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.HashMap;

public class JsonTask extends AsyncTask<String, Void, String> {
    private HashMap<String, String> map;
    private CallBackObject call;

    public JsonTask(HashMap<String, String> map, CallBackObject call) {
        this.map = map;
        this.call = call;
    }

    @Override
    protected String doInBackground(String... params) {
        List<Object> list = new ArrayList<>();
        String json = "";
        try {
            json = HttpUtils.post(params[0], map);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }


        return json;
    }

    @Override
    protected void onPostExecute(String json) {
        super.onPostExecute(json);
        call.loader(json);
    }

    public interface CallBackObject {
        public void loader(String json);
    }

}
